Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Dec 6, 2025

This PR attempts to address Issue #9879. Feedback and guidance are welcome.

Problem

The Z.ai provider currently only shows coding plan endpoints but not the regular API endpoints. Users who are using API billing need access to the standard API endpoints.

Solution

Added two new API line options to support regular API billing:

Changes

  • Added new API line options to zaiApiLineSchema in packages/types/src/provider-settings.ts
  • Added corresponding endpoint configurations to zaiApiLineConfigs in packages/types/src/providers/zai.ts
  • Updated display names to distinguish between "Coding" and "API" endpoints for clarity
  • Added comprehensive tests for the new API endpoints in src/api/providers/__tests__/zai.spec.ts

Testing

  • All existing tests pass
  • Added new test cases for both international_api and china_api endpoints
  • Verified correct base URLs are used for each endpoint
  • Confirmed proper model selection based on region

Fixes #9879


Important

Add international_api and china_api endpoints for Z.ai provider with tests and configuration updates.

  • Behavior:
    • Added international_api and china_api endpoints to zaiApiLineSchema in provider-settings.ts.
    • Updated zaiApiLineConfigs in zai.ts with new endpoint configurations.
    • Updated display names for clarity between "Coding" and "API" endpoints.
  • Testing:
    • Added tests for international_api and china_api in zai.spec.ts.
    • Verified correct base URLs and API key usage for new endpoints.
    • Confirmed model selection and configuration for both new endpoints.
  • Misc:
    • All existing tests pass.

This description was created by Ellipsis for ab9d34f. You can customize this summary. It will automatically update as commits are pushed.

- Add international_api and china_api options to zaiApiLineSchema
- Add corresponding endpoint configurations to zaiApiLineConfigs
- Update display names to distinguish between Coding and API endpoints
- Add comprehensive tests for new API endpoints

Fixes #9879
@roomote
Copy link
Contributor Author

roomote bot commented Dec 6, 2025

Rooviewer Clock   See task on Roo Cloud

Review completed. Found 1 issue that needs attention:

  • Verify China API endpoint URL - the issue specifies pass but implementation uses paas

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 6, 2025
@richtong
Copy link

richtong commented Dec 7, 2025

Ye that's correct a typo in original issue. Fixed. Should be paas

@mrubens
Copy link
Collaborator

mrubens commented Dec 7, 2025

@hannesrudolph @richtong looks like we removed the other two endpoints here, but I can't remember why: #8693.

@richtong just to confirm - you have an API key that works with the regular endpoint and not the coding endpoint?

@hannesrudolph
Copy link
Collaborator

@hannesrudolph @richtong looks like we removed the other two endpoints here, but I can't remember why: #8693.

@richtong just to confirm - you have an API key that works with the regular endpoint and not the coding endpoint?

They told us to as they would manage the switching at their end

@richtong
Copy link

richtong commented Dec 7, 2025 via email

@richtong
Copy link

richtong commented Dec 7, 2025 via email

@richtong
Copy link

richtong commented Dec 9, 2025

@hannesrudolph @richtong looks like we removed the other two endpoints here, but I can't remember why: #8693.

@richtong just to confirm - you have an API key that works with the regular endpoint and not the coding endpoint?

Yes that's correct, we an API key that only works with regular endpoints and not the coding endpoints, so be nice to allow those urls as well :-)

@richtong
Copy link

@mrubens yes just confirmed we need the api end point with z.ai

@hannesrudolph @richtong looks like we removed the other two endpoints here, but I can't remember why: #8693.

@richtong just to confirm - you have an API key that works with the regular endpoint and not the coding endpoint?

@roomote
Copy link
Contributor Author

roomote bot commented Dec 10, 2025

Hi @mrubens and @hannesrudolph,

Based on the discussion, it appears that:

  1. The user (@richtong) has confirmed they need the regular API endpoints - They have an API key that only works with the regular endpoints (not the coding endpoints)
  2. The Z.ai documentation confirms this distinction - Per their docs at https://docs.z.ai/guides/develop/http/introduction, they specify:
    • General API endpoint: https://api.z.ai/api/paas/v4/
    • Coding endpoint: https://api.z.ai/api/coding/paas/v4/ (only for Coding Plan users)
  3. The user gets rate limit errors when trying to use their API key with the coding endpoint

While PR #8693 previously removed these endpoints based on Z.ai's indication they would handle switching at their end, it seems this hasn't been implemented yet, and users with API-only accounts still need access to the regular endpoints.

This PR adds back the regular API endpoints to support users with API billing accounts. All tests are passing and the implementation looks good.

Could we get this reviewed for approval? This would unblock users who have API-only accounts with Z.ai.

cc: @richtong

@hannesrudolph hannesrudolph moved this from Triage to PR [Needs Review] in Roo Code Roadmap Dec 11, 2025
@hannesrudolph hannesrudolph marked this pull request as ready for review December 11, 2025 06:51
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Dec 11, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Dec 11, 2025

Rooviewer Clock   See task on Roo Cloud

Review completed. No issues found.

The previous concern about paas vs pass in the URL has been resolved - @richtong confirmed that paas (Platform as a Service) is the correct path per Z.ai documentation.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

Copy link
Collaborator

@hannesrudolph hannesrudolph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Needed

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 11, 2025
@hannesrudolph hannesrudolph added PR - Needs Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Dec 11, 2025
@cte cte mentioned this pull request Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer PR - Needs Review size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[BUG] Z.ai Provider does not show general API endpoint (only has coding plan endpoints)

5 participants